package org.easy.core.util;

import org.springframework.util.DigestUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author: Li chaojie
 * @Date: 2022/7/14
 * @Description:
 */
public class FileChecksumUtil {

    public static String md5DigestAsHex(File file) {
        try (FileInputStream fis = new FileInputStream(file)) {
            return DigestUtils.md5DigestAsHex(fis);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
